package com.example.leavevaadin;

import com.vaadin.Application;
import com.vaadin.ui.*;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;

public class LeaveOnline extends Application {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	public void init() {
		Window main = new Window("Leave Application Portal - Team 10");
		/*
		 * Label label = new Label("Hello Vaadin user");
		 * mainWindow.addComponent(label);
		 */
		addLogOutButton(main);
		
		main.addComponent(new WindowOpener("Window Opener", main));
		setMainWindow(main);

	}

	private void addLogOutButton(Window main) {
		Button closeButton = new Button("Logout");
		closeButton.addListener(new Button.ClickListener() {
			public void buttonClick(ClickEvent event) {
				getMainWindow().getApplication().close();
			}
		});
		main.addComponent(closeButton);
		
		setLogoutURL("/LeaveOnline/logout.jsp");
	}

}
